package com.wwtech.epp.entity;

import android.os.Parcel;
import android.os.Parcelable;

import java.nio.file.Files;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by hu on 2017/10/11.
 */

public class TaskDetail implements Parcelable{

    /**
     * avatar : http://s3.cn-north-1.amazonaws.com.cn/zxltest/20171020/fdb946e1784042359184feb4745021b0.jpg
     * createTime : 2017-12-09 17:28:55
     * createrId : 10221
     * deadline : 2017-12-31 00:00:00
     * files : [{"fileId":7,"fileName":"com.baidu.tieba.png","fileUrl":"http://s3.cn-north-1.amazonaws.com.cn/zxltest/20171209/1df14f05806d4f0697b67e375e0ac789.png","jobId":98},{"fileId":8,"fileName":"P70609-143252.jpg","fileUrl":"http://s3.cn-north-1.amazonaws.com.cn/zxltest/20171209/202b7bc3fa574612862f7d7da0bca5e7.jpg","jobId":98},{"fileId":9,"fileName":"P70609-143248.jpg","fileUrl":"http://s3.cn-north-1.amazonaws.com.cn/zxltest/20171209/8e4ed4fa7f314ee0bd0651a0b700796c.jpg","jobId":98}]
     * jobContent : 测
     * jobId : 0
     * jobState : 0
     * jobTitle : 测试五
     * nickName : 刘松涛
     * ownerId : 10213
     * projectId : 113
     * projectName : 测试项目
     * roleLevel : 3
     * state : 0
     */

    private String avatar;
    private String createTime;
    private int createrId;
    private String deadline;
    private String jobContent;
    private int jobId;
    private int jobState;
    private String jobTitle;
    private String nickName;
    private int ownerId;
    private int projectId;
    private String projectName;
    private int roleLevel;
    private int state;
    private ArrayList<TaskAttachmentFile> files;

    protected TaskDetail(Parcel in) {
        avatar = in.readString();
        createTime = in.readString();
        createrId = in.readInt();
        deadline = in.readString();
        jobContent = in.readString();
        jobId = in.readInt();
        jobState = in.readInt();
        jobTitle = in.readString();
        nickName = in.readString();
        ownerId = in.readInt();
        projectId = in.readInt();
        projectName = in.readString();
        roleLevel = in.readInt();
        state = in.readInt();
        if (files == null) {
            files = new ArrayList<TaskAttachmentFile>();
        }
        in.readList(files, TaskAttachmentFile.class.getClassLoader());
    }

    public static final Creator<TaskDetail> CREATOR = new Creator<TaskDetail>() {
        @Override
        public TaskDetail createFromParcel(Parcel in) {
            return new TaskDetail(in);
        }

        @Override
        public TaskDetail[] newArray(int size) {
            return new TaskDetail[size];
        }
    };

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public int getCreaterId() {
        return createrId;
    }

    public void setCreaterId(int createrId) {
        this.createrId = createrId;
    }

    public String getDeadline() {
        return deadline;
    }

    public void setDeadline(String deadline) {
        this.deadline = deadline;
    }

    public String getJobContent() {
        return jobContent;
    }

    public void setJobContent(String jobContent) {
        this.jobContent = jobContent;
    }

    public int getJobId() {
        return jobId;
    }

    public void setJobId(int jobId) {
        this.jobId = jobId;
    }

    public int getJobState() {
        return jobState;
    }

    public void setJobState(int jobState) {
        this.jobState = jobState;
    }

    public String getJobTitle() {
        return jobTitle;
    }

    public void setJobTitle(String jobTitle) {
        this.jobTitle = jobTitle;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public int getOwnerId() {
        return ownerId;
    }

    public void setOwnerId(int ownerId) {
        this.ownerId = ownerId;
    }

    public int getProjectId() {
        return projectId;
    }

    public void setProjectId(int projectId) {
        this.projectId = projectId;
    }

    public String getProjectName() {
        return projectName;
    }

    public void setProjectName(String projectName) {
        this.projectName = projectName;
    }

    public int getRoleLevel() {
        return roleLevel;
    }

    public void setRoleLevel(int roleLevel) {
        this.roleLevel = roleLevel;
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public ArrayList<TaskAttachmentFile> getFiles() {
        return files;
    }

    public void setFiles(ArrayList<TaskAttachmentFile> files) {
        this.files = files;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeString(avatar);
        parcel.writeString(createTime);
        parcel.writeInt(createrId);
        parcel.writeString(deadline);
        parcel.writeString(jobContent);
        parcel.writeInt(jobId);
        parcel.writeInt(jobState);
        parcel.writeString(jobTitle);
        parcel.writeString(nickName);
        parcel.writeInt(ownerId);
        parcel.writeInt(projectId);
        parcel.writeString(projectName);
        parcel.writeInt(roleLevel);
        parcel.writeInt(state);
        parcel.writeList(files);
    }

}
